package com.sxt.bus.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.sxt.bus.domain.Goods;
import com.sxt.bus.domain.Provider;
import com.sxt.bus.mapper.ProviderMapper;
import com.sxt.bus.service.ProviderService;
import com.sxt.bus.vo.GoodsVo;
import com.sxt.bus.vo.ProviderVo;
import com.sxt.bus.utils.DataGridView;
@Service
public class ProviderServiceImpl implements ProviderService{

	@Autowired
	private ProviderMapper providerMapper;
	
	
	@Override
	public DataGridView queryAllProvider(ProviderVo providerVo) {
		Page<Object> page = PageHelper.startPage(providerVo.getPage(),providerVo.getLimit());
		List<Provider> data = providerMapper.queryAllProvider(providerVo);
		return new DataGridView(page.getTotal(),data);
	}

	@Override
	public Integer updateProvider(ProviderVo providerVo) {
		// TODO Auto-generated method stub
		
		return providerMapper.updateByPrimaryKeySelective(providerVo);
	}

	@Override
	public Integer addProvider(ProviderVo providerVo) {
		// TODO Auto-generated method stub
		return providerMapper.insertSelective(providerVo);
	}

	@Override
	public Integer deleteProvider(Integer id) {
		// TODO Auto-generated method stub
		return providerMapper.deleteByPrimaryKey(id);
	}

	@Override
	public List<Provider> queryAllProviderForlist() {
		// TODO Auto-generated method stub
		return providerMapper.queryAllProviderForlist();
	}

	@Override
	public List<Provider> loadAllgoods() {
		// TODO Auto-generated method stub
		return providerMapper.queryAllProviderForlist();
	}

	@Override
	public List<Provider> loadAllProviderForList(ProviderVo providerVo) {
		// TODO Auto-generated method stub
		return providerMapper.queryAllProviderForListProviderId(providerVo);
	}

}
